



def get_asm(reg_name):
	tpl_str = """
	adr x1, #0xc
	mrs x0, $REG_NAME
	b _event
	"""
	return tpl_str.replace("$REG_NAME", reg_name)

def parse_file(fpath):
	with open(fpath) as f:
		for line in f:
			line = line.strip()
			sp = line.split(" 	")
			name = sp[1]
			if (name.find(" ")>=0 or name.find("<")>=0
				or name.find("ICC")>=0 or name.find("ICH")>=0
				or name=="CPSR"):
				continue
			rs = get_asm(name)
			print rs

reg_define_path="/mnt/hgfs/wrok/dev/task/cosim_kify/src/tarmac/reg/tool/aarch64_sys_reg_define.txt"


parse_file(reg_define_path)